import {request} from "vendor/utils/T";
import {toApi} from "@/service/proxyApi";
import { EnumRouter } from "@/constants";
import {RequestDataType, RespDataType} from "./apiType";

export * from "./apiType";
const {get, postJSON, del, put, mockRespData, wrapperRespDataFN} = request;

/**
 * 获取初始化数据
 */
export const getInitData = () => {
    return wrapperRespDataFN<RespDataType.InitData>(() => fetch(EnumRouter.to("config/networkSimulation.json")).then((resp) => resp.json()))

    return mockRespData<RespDataType.InitData>({
        "mainNetwork": {
            "siteRenderer":{
                "type": "image",
                "sourceUrl": "/asserts/networkSimulation/img/mainSite.png"
            },
            "siteList": [
                {
                    "id": "1",
                    "name": "北京",
                    "position": {
                        "lng": 116.383129662412,
                        "lat": 39.84286109172407,
                    }
                },
                {
                    "id": "2",
                    "name": "其他地区",
                    "position": {
                        "lng": 106.35,
                        "lat": 34.21,
                    }
                }
            ],
            "siteRelation": {
                "1": ["2"],
            }
        },
        "localNetworkDeviceList": [
            {
                "label": "雷达",
                "value": "radar",
                "renderer": {
                    "type": "gltf",
                    "sourceUrl": "/asserts/networkSimulation/gltf/radar/34M_17.gltf"
                }
            },
            {
                "label": "微波",
                "value": "microwave",
                "renderer": {
                    "type": "image",
                    "sourceUrl": "/asserts/networkSimulation/img/microwave.png"
                }
            },
            {
                "label": "短波",
                "value": "shortwave",
                "renderer": {
                    "type": "image",
                    "sourceUrl": "/asserts/networkSimulation/img/shortwave.png"
                }
            },
        ]
    });
}
